<!DOCTYPE HTML>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0, minimum-scale=1.0, user-scalable=0, initial-scale=1.0, width=device-width" />
    <meta name="format-detection" content="telephone=no, email=no, date=no, address=no">
    <title value=''>我的收藏</title>
    <link rel="stylesheet" type="text/css" href="../css/aui.css" />
    <link rel="stylesheet" type="text/css" href="../css/main.css" />

    <style>
    .back1 {
        /*width: 13px !important;
        height: 21px !important;
        margin-top: 11px;
        margin-left: 15px;*/
        width: 15px !important;
        height: 25px !important;
        margin-top: 12px;
        margin-left: 15px;
    }
    /*.back1 {
      width: 10px !important;
      height: 16px !important;
      margin-top: 15px;
      margin-left: 15px;
    }*/
    .button{
    background-color:#000;
    background-color:rgba(0,0,0,0);
    margin: 0px;
    border: 0px;
    line-height: 2.25rem;
    height: 2.25rem;
  }

    </style>
</head>

<body>
  <header class="aui-bar aui-bar-nav" id="aui-header" style="background-color:#ea5718;">
      <div class="aui-pull-left" onclick="closeWin()">
          <img src="../image/login/back.png" class="back1" alt="">
      </div>
      <div class="aui-title">我的收藏</div>
      <button class="aui-pull-right button" style="font-size:13px;margin-right:17px" onclick="edit()" v-if="editflag">管理</button>
      <button class="aui-pull-right button" style="font-size:13px;margin-right:17px" v-if="!editflag && !cancelcollectflag" onclick="finish()">完成</button>
      <button class="aui-pull-right button" style="font-size:13px;margin-right:17px" v-if="!editflag && cancelcollectflag" disabled onclick="finish()">完成</button>
  </header>



 <footer></footer>
</body>
<script type="text/javascript" src="../script/api.js"></script>
<script type="text/javascript" src="../script/win.js"></script>
<script type="text/javascript" src="../script/config.js"></script>
<script type="text/javascript" src="../script/rest.js"></script>
<script type="text/javascript" src="../script/vue.2.5.js"></script>
<script type="text/javascript" src="../script/zepto.js"></script>
<script type="text/javascript" src="../script/faskclick.js"></script>
<script type="text/javascript">
    var vm, uid;
    apiready = function() {
        uid = $api.getStorage('uid');
        api.parseTapmode();
        var header = $api.dom('header'); // 获取 header 标签元素
        var footer = $api.dom('footer'); // 获取 footer 标签元素
        var headerH = $api.fixStatusBar(header);
        var footerH = $api.fixTabBar(footer);
        if ('addEventListener' in document) {
            document.addEventListener('DOMContentLoaded', function() {
                FastClick.attach(document.body);
            }, false);
        }
        api.openFrame({
            name: 'mycollect_frm',
            url: 'mycollect_frm.html',
            bounces: false,
            rect: {
              marginTop: headerH, // main页面距离win顶部的高度
               marginBottom: footerH, // main页面距离win底部的高度
                w: 'auto',
                h: api.winHeight - headerH-footerH
            },
        })
        vm = new Vue({
            el: '#aui-header',
            data: {
                editflag: true,
                cancelcollectflag:false

            },
            created: function() {
                var _this = this;
                _this.init();

            },
            methods: {
                init: function() {
                    var _this = this;
                    api.addEventListener({
                        name: 'clickcancelcollect'
                    }, function(ret, err) {
                      _this.cancelcollectflag=true;
                    });

                    api.addEventListener({
                        name: 'clickcancelcollect1'
                    }, function(ret, err) {
                      _this.cancelcollectflag=false;
                    });

                },

            }
        })
        api.addEventListener({
            name: 'delecollect'
        }, function(ret, err) {
            // vm.editflag = true
            vm.init()
        });

    };

    function edit() {
        api.sendEvent({
            name: 'edit',
            extra: {
                edit: 'bianji',
            }
        });
        vm.editflag = false
    }

    function finish() {
        api.sendEvent({
            name: 'edit',
            extra: {
                edit: 'cancle',
            }
        });
        vm.editflag = true
    }

    function closeWin() {
        if (vm.editflag == false) {
            finish()
        } else {
            api.closeWin({});

        }
    }
</script>

</html>
